const RedisBase = require('../common/RedisBase');
const game_config = require('../config/game_config');
const log = require('../utils/log');
const resCode = require("../config/ResCode");
const Redis = require("../common/Redis");


class hallRedis extends Redis{
    static getInstance(){
        if(!hallRedis.instance){
            hallRedis.instance = new hallRedis();
            return hallRedis.instance;
        }else{
            return hallRedis.instance;
        }
    }

    constructor() {
        super(game_config.center_redis.host,game_config.center_redis.port,game_config.center_redis.db_index);
    }

    //设置幸运抽奖的奖品配置数据
    async setChouJiangCfg(data){
        let key = `hd_choujiang_cfg`;
        let res = await this.set(key,JSON.stringify(data));
        return res;
    }
    //获取幸运抽奖的奖品配置数据
    async getChouJiangCfg(){
        let key = `hd_choujiang_cfg`;
        let res = await this.get(key);
        return JSON.parse(res);
    }
}

global.hallSerMgr.hallRedis = hallRedis.getInstance();
// log.error('=======global.loginSerMgr.hallRedis===========',global.loginSerMgr.hallRedis);
module.exports = hallRedis;